<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>我的会员管理</title>
<%@ include file="../security/include.inc.jsp"%>
<script type="text/javascript" src="<%=basePath%>/scripts/prd/js/checkIdNo.js"></script>
<script type="text/javascript">
$(function(){
	$("#navi1").addClass("navi_content_a_on");
})
</script>
</head>
<body>
	<%@ include file="header.jsp"%>
	<div class="main">
		<script type="text/javascript">
			
			function left_open(id) {

				$('#' + id).slideToggle(200);

			}
		</script>

		<div class="main">
			<style>
.table4 table td {
	border-bottom: none;
}
</style>
			<div class="table1" style="margin-bottom: 25px;">
				<div class="title1">
					<div class="th2">基本信息</div>
				</div>
				<div class="table2">
					<div class="qpreg">
						<ul>
							<li><span class="qpregtitle">账号：</span>${member.member_id }</li>
							<li><span class="qpregtitle">昵 称：</span> <input
								class="qpregtext" id="name" type="text" style="width: 150px;"
								value="${member.name}" /></li>
							<li><span class="qpregtitle">性别：</span> <input name="sex"
								id="sexM" type="radio" value="1" checked="checked">男 <input
								id="sexF" name="sex" type="radio" value="0">女</li>
							<li><span class="qpregtitle">服务机构：</span> <input
								class="qpregtext" id="service_company" type="text"
								style="width: 150px;" value="${member.service_company}" /></li>
							<li><span class="qpregtitle">机构地址：</span> <input
								class="qpregtext" id="company_add" type="text"
								style="width: 150px;" value="${member.company_add}" /></li>
							<li><span class="qpregtitle">职位：</span> <input
								class="qpregtext" id="position" type="text"
								style="width: 150px;" value="${member.position}" /></li>
							<li><span class="qpregtitle">出生年月：</span> <input
								id="brith_date" name="brith_date" type="text" value="${member.brith_date }"
								onclick="SelectDate(this,'yyyy-MM')" datatype="birthday"
								class="qpregtext" errormsg="请输入正确的生日！" style="width: 130px;" /><span
								id="vc3" class="Validform_checktip"></span></li>
							<li><span class="qpregtitle">联系电话：</span> <input
								class="qpregtext" id="mobile" type="text" style="width: 150px;"
								value="${member.mobile}" /></li>
							<li><span class="qpregtitle">EMAIL：</span> <input
								class="qpregtext" id="email" type="text" style="width: 150px;"
								value="${member.email}" /></li>
							<li><span class="qpregtitle">身份证号码：</span> <input
								class="qpregtext" id="id_card" type="text" style="width: 150px;"
								value="${member.id_card}" /></li>

						</ul>
					</div>
				</div>
				<div class="qpbtn"
					style="clear: both; text-align: left; padding-left: 280px; padding-top: 20px;">
					<input id="bankSign" name="" type="button" value="修改"
						class="nextbtn go_focus" onclick="subData()" />
				</div>
			</div>
		</div>
	</div>
	<script type="text/javascript">
		function subData(){
			var data = {};
			data.state = 'modified';
			data.member_id = '${member.member_id}';
			data.name = $("#name").val();
			data.service_company = $("#service_company").val();
			data.company_add = $("#company_add").val();
			data.position = $("#position").val();
			data.brith_date = $("#brith_date").val();
			data.mobile = $("#mobile").val();
			data.email = $("#email").val();
			data.id_card = $("#id_card").val();
			
			if (data.name == "") {
				alert("姓名为空！");
				return false;
			}
			if (data.service_company == "") {
				alert("服务机构为空！");
				return false;
			}
			if (data.companyAddr == "") {
				alert("机构地址为空！");
				return false;
			}
			if (data.position == "") {
				alert("职位为空！");
				return false;
			}
			if (data.brith_date == "") {
				alert("出生年月为空！");
				return false;
			}
			var bdate = /[0-9]{4}-[0-9]{2}/.test(data.brith_date);
			if(!bdate){
				alert("出生年月格式不正确，正确格式为'1980-03'");
				return false;
			}
			if (data.email == "") {
				alert("邮箱地址为空！");
				return false;
			}
			if(data.email.search(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/) == -1){
				alert("请输入正确的邮件地址！");
				return;
			}	
			
			if (data.mobile == "") {
				alert("手机号码为空！");
				return false;
			}
			
			if (data.id_card == "") {
				alert("身份证号码为空！");
				return false;
			}
			if(!IdCardValidate(data.id_card)) {
				alert("请输入正确的身份证号码！");
				return false;
			}			
			console.log(data);
			var json = mini.encode(data);
	 		$.ajax({
	 			url  : '<%=basePath%>/member/doEnrich',
	 			type : 'post',
	 			data : {data:json},
	 			success : function(text){
	 				alert(text);
	 				
	 			}
	 		});
		}
	</script>
</body>
</html>